/**     
 * @Title: IndexController.java   
 * @Package com.yitong.controller   
 * @Description: TODO
 * @author weiwei 
 * @date 2017年7月20日 上午11:13:33   
 * @version V1.0     
 */
package com.yitong.controller;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yitong.bean.UserInfo;

/**
 * @ClassName: IndexController
 * @Description: TODO
 * @author weiwei
 * @date 2017年7月20日 上午11:13:33
 * 
 */
@Controller
@EnableAutoConfiguration
public class IndexController {

	private final static Logger LOGGER = LoggerFactory.getLogger(IndexController.class);

	@RequestMapping("/hello")
	@ResponseBody
	public String hello(Model model) {
		LOGGER.info("Hello World");
		return "Hello World!";
	}

	@RequestMapping("/json")
	@ResponseBody
	public UserInfo json(Model model) {
		UserInfo u = new UserInfo();
		u.setUserId("1");
		u.setUserName("u name");
		u.setEmail("rr@u.com");
		LOGGER.info("UserInfo >> " + u);
		return u;
	}

	@RequestMapping("/index")
	public String index(Model model) {
		LOGGER.info("index");
		return "index";
	}

}
